@echo off
set path=%path%;%~dp0
for /f "tokens=*" %%a in ('^
wget -qO- http://www.oracle.com/technetwork/java/javase/downloads/index.html ^|
sed "s/\d034\/technetwork\//\n\/technetwork\//g;s/\.html\d034/\.html\n/g" ^|
grep "^\/technetwork\/.*javase\/downloads\/jre7.*html"') do for /f "tokens=*" %%b in ('^
wget -qO- http://www.oracle.com%%a ^|
grep "downloads.*jre.*files.*windows" ^|
grep -v "Kernel\|Online\|Itanium\|ia64\|zip\|tar\.gz" ^|
sed "s/\d034http/\nhttp/g;s/exe\d034/exe\n/g" ^|
grep "^http.*"') do for /f "tokens=7 delims=/" %%c in ('echo %%b') do (
wget --no-cookies --no-check-certificate ^
--header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" ^
"%%b" -O "%~dp0%%c"
)
pause
